import { createRouter, createWebHistory } from "vue-router";

const routes = [
  {
    name: "notFound",
    path: "/:path(.*)+",
    redirect: {
      name: "404",
    },
  },
  {
    name: "404",
    path: "/",
    component: () =>
      import(/* webpackChunkName: "404" */ "./views/notfound/index.vue"),
  },
  {
    name: "test",
    path: "/test",
    component: () => import("./views/test/index.vue"),
  },
  {
    name: "use",
    path: "/use",
    component: () => import("./views/use/index.vue"),
  },
  {
    name: "iNoBounce",
    path: "/inobounce",
    component: () => import("./views/inobounce/index.vue"),
  },
  {
    name: "hello",
    path: "/hello",
    component: () => import("./views/hello/index.vue"),
  },
  {
    name: "vant",
    path: "/vant",
    component: () => import("./views/vant/index.vue"),
  },
];

const router = createRouter({
  routes,
  history: createWebHistory("/base/"),
});

// router.beforeEach((to, from, next) => {
//   const title = to.meta && to.meta.title;
//   if (title) {
//     document.title = title;
//   }
//   next();
// });

export { router };
